'use strict';
module.exports = {
	/**
	 * XXXnameXXX
	 * @url client/pages/order/kh/get_order_list 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let {
			data = {}, userInfo, util, filterResponse, originalParam
		} = event;
		let {
			customUtil,
			uniID,
			config,
			pubFun,
			vk,
			db,
			_
		} = util;
		let {
			uid,
			status,
			order_page,
			order_total
		} = data;
		let res = {
			code: 0,
			msg: ""
		};
		// 业务逻辑开始-----------------------------------------------------------
		console.log('status', status)

		let WhereJson = {
			status: status,
			user_id: uid
		}

		if (status === 'all') {
			WhereJson['status'] = _.neq(-1)
		}
		console.log('last', WhereJson)
		const order_list = await vk.baseDao.select({
			dbName: "daoju_order",
			getMain: true,
			pageIndex: order_page,
			pageSize: order_total, // 每页条数
			whereJson: WhereJson,
			sortArr: [{
				name: "create_time",
				type: "desc"
			}],
		})

		res.order_list = order_list

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
